package st.business.tepth.business.user.busnumber.workholder.maintain.work.content.standardwork.workdetail;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.EditText;

import st.business.tepth.R;
import st.business.tepth.base.OnItemChooseListener;

/**
 * @author zhangyu
 * @date 2019/8/13
 */
public class DialogInputValue extends Dialog {
    public DialogInputValue(@NonNull Context context,
                            final OnItemChooseListener<String> listener) {
        super(context);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        View view = LayoutInflater.from(context).
                inflate(R.layout.dialog_input_measure_value, null);
        view.findViewById(R.id.iv_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        final EditText etValue = view.findViewById(R.id.et_value);
        view.findViewById(R.id.tv_confirm).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.onChoose(etValue.getText().toString());
                }
                dismiss();
            }
        });
        setContentView(view);
    }
}
